
$jQ(document).ready(function() {
	
	if (paginaAtual == "signup_page.php") {

		var textUsuario = ":text[name='username']";
		var textEmail = ":text[name='email']";
		var buttonCriar = ":submit[value='Criar Conta']";
		$jQ( "#dialog" ).dialog({
            autoOpen: false,
            show: "explode",
            hide: "explode",
            resizable: false,
            buttons: [ 
                       { 
                    	   text: "Fechar",
                    	   click: function() {
                    		   $jQ( this ).dialog( "close" ); 
                    	   } 
                       }
                       ]
        });
		
		
		$jQ("[name='signup_form']").submit(function(evt) {
			
			var submeter = true;
			var options = { to: buttonCriar, className: "ui-effects-transfer" };
			var mensagem = "";
			
			if ($jQ.trim($jQ(textUsuario).val() == "")) {
				options = { to: textUsuario, className: "ui-effects-transfer" };
				mensagem = "Favor informar o Nome do Usuário.";
				submeter = false;
			} else if ($jQ.trim($jQ(textEmail).val() == "")) {
				options = { to: textEmail, className: "ui-effects-transfer" };
				mensagem = "Favor informar o E-Mail.";
				submeter = false;
			}
			
			if (!submeter) {
				evt.preventDefault();
				$jQ("#mensagem").text(mensagem);
				$jQ("#dialog").dialog({ title: "TESTE" });
				$jQ( "#dialog" ).dialog( "open" );
			}
			
		});	
	}
});